package com.hospital.dictionary.module.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.common.core.result.SuccessTip;
import com.hospital.common.core.result.Tip;
import com.hospital.dictionary.constant.CommonConstant;
import com.hospital.dictionary.module.controller.base.BaseController;
import com.hospital.dictionary.module.entity.DeptDict;
import com.hospital.dictionary.module.service.DeptDictService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lvyao
 * @since 2022-02-14
 */
@RestController
@RequestMapping("/module/deptDict")
public class DeptDictController extends BaseController<DeptDict, DeptDictService> {
    @Resource
    private DeptDictService deptDictService;
    /**
     * @description:根据key值维护的对照关系 获取所有现在有对照关系
     * @author: lvyao
     * @date: 2024/1/10 15:16
     * @param deptCode:
     * @return: com.hospital.dictionary.result.Tip
     **/
    @GetMapping(value = "/getBycode")
    public Tip getKeyList(@RequestParam(name = "deptCode") String deptCode){
       DeptDict deptDict = deptDictService.getOne(new QueryWrapper<DeptDict>().eq(CommonConstant.GUIDE_KEY_CODE, deptCode));
        return new SuccessTip(deptDict);
    }

}

